<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-hatchetSystemConfig-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">配置名称：</label>
				<div class="col-sm-8">
					<input id="configName" name="configName" class="form-control" type="text">
				</div>
			</div>
		<!-- 	<div class="form-group">	
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<input id="status" name="status" class="form-control" type="text">
				</div>
			</div> -->
			<div class="form-group">	
				<label class="col-sm-3 control-label">配置代码：</label>
				<div class="col-sm-8">
					<input id="configCode" name="configCode" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="rEMARK" name="rEMARK" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">配置的值：</label>
				<div class="col-sm-8">
					<input id="configValue" name="configValue" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/hatchetSystemConfig"
		$("#form-hatchetSystemConfig-add").validate({
			rules:{
				configCode:{
        			required:true,
                    remote: {
                        url: prefix + "/checkConfigCode",
                        type: "post",
                        dataType: "json",
                        data: {
                            name: function () {
                                return $.common.trim($("#configCode").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
        		},
			},
			messages: {
                "configCode": {
                    remote: "变量代码已存在"
                }
            }
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-hatchetSystemConfig-add').serialize());
	        }
	    }
	</script>
</body>
</html>
